package auth

import (
	"blog/core"
	"blog/utils"
	"strconv"
)

type Login struct{}

func (l *Login) GetToken(id, expire int) (string, error) {
	token, err := utils.GetToken(id)
	if err != nil {
		return "", err
	}

	core.Redis.GetString().SetEx("user_jwt_"+strconv.Itoa(id), token, int64(expire))

	return token, nil
}
